// collate::hash example
#include <stdio.h>

void insertion_sort(int a[], int length) {
  int key;
  int j;
  for(int i = 1; i < length; i++) {
    key = a[i];
    j = i - 1;
    while(j >= 0 && a[j] > key) {
      a[j+1] = a[j];
      j--;
    }
    a[j+1] = key;  
  }
  for(int i = 0; i < length; i++) {
    printf("%d \n", a[i]);
  }
}


int main ()
{
  int a[5] = {1,2,3,4,0};
  insertion_sort(a, 5);
  return 0;
}


